#include "gtest/gtest.h"
#include "Utilities.h"

USING_NS_B2D

TEST(test_utilities, test_nullify)
{
	int value = 1;
	int* ptr = &value;


	auto checkNullDuring = [&]()
	{
		TempNullify<int> nullify(ptr);
		bool tmp = (ptr == nullptr);
		return tmp;
	};

	bool nullBefore = (ptr == nullptr);
	bool nullDuring = checkNullDuring();
	bool nullAfter = (ptr == nullptr);

	EXPECT_EQ(false, nullBefore);
	EXPECT_EQ(true, nullDuring);
	EXPECT_EQ(false, nullAfter);
}